// "Add to basket" button
(function($) { // remove product from basket SKELETON BAHEVIOUR
	   $.fn.addProductToBasket = function(settings) {

		var config = {
			'notify': function(messageBox, data){messageBox.html(data.message);},
			'postAdd': function(data){ $('#basket_preview_box').html(data.html) },
			'preAdd' : function(){}
		};
		 settings = $.extend(config, settings);

		 var notify = settings['notify'];
		 var postAdd = settings['postAdd'];
		 var preAdd = settings['preAdd'];

	     this.each(function(i, elm) {
	    	$(elm).click(function(e){
				e.preventDefault();
				preAdd();

				var link = $(this);
				var par = link.parent();
				var qty = $('input[name=qty]',par).val();

				$.post($(this).attr('href'),{qty: qty}, function(data){
					notify(link, data);
					postAdd(data);
				},'json');

				return false;
	    	});

	     });

	     return this;
	   };
})(jQuery);